package com.css.dzj.dzjwgr.modules.boards.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.util.Date;
import java.util.Objects;

@Entity
@Table(name = "BOARDS", schema = "DZJWGR", catalog = "")
public class BoardsEntity {
    //主键ID
    private String id;
    //标题
    private String title;
    //创建人
    private String createUser;
    //创建人单位
    private String createUserunit;
    //状态 0是未发布，1是已发布，2是已撤销
    private String statte;
    //发布时间
    @JsonFormat(shape= JsonFormat.Shape.STRING,pattern="yyyy-MM-dd",timezone="GMT+8")
    private Date releaseTime;
    //创建时间
    private Date createTime;
    //宣传稿内容
    private String draftContent;
    //更新时间
    private Date updateTime;
    //修改人
    private String updateUser;
    //逻辑删除标识 0为未删除，1已删除
    private String delFlag;

    @Id
    @Column(name = "Id")
//    @GeneratedValue(generator = "idGenerator")
//    @GenericGenerator(name = "idGenerator", strategy = "com.css.dzj.dzjwgr.common.util.SnowflakeId")
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Basic
    @Column(name = "title")
    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    @Basic
    @Column(name = "create_User")
    public String getCreateUser() {
        return createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    @Basic
    @Column(name = "create_Userunit")
    public String getCreateUserunit() {
        return createUserunit;
    }

    public void setCreateUserunit(String createUserunit) {
        this.createUserunit = createUserunit;
    }

    @Basic
    @Column(name = "statte")
    public String getStatte() {
        return statte;
    }

    public void setStatte(String statte) {
        this.statte = statte;
    }

    @Basic
    @Column(name = "release_Time")
    @JsonFormat(shape= JsonFormat.Shape.STRING,pattern="yyyy-MM-dd HH:mm",timezone="GMT+8")
    public Date getReleaseTime() {
        return releaseTime;
    }

    public void setReleaseTime(Date releaseTime) {
        this.releaseTime = releaseTime;
    }

    @Basic
    @Column(name = "create_Time")
    @JsonFormat(shape= JsonFormat.Shape.STRING,pattern="yyyy-MM-dd",timezone="GMT+8")
    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Basic
    @Column(name = "draft_Content")
    public String getDraftContent() {
        return draftContent;
    }

    public void setDraftContent(String draftContent) {
        this.draftContent = draftContent;
    }

    @Basic
    @Column(name = "update_Time")
    @JsonFormat(shape= JsonFormat.Shape.STRING,pattern="yyyy-MM-dd HH:mm",timezone="GMT+8")
    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    @Basic
    @Column(name = "update_User")
    public String getUpdateUser() {
        return updateUser;
    }

    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }

    @Basic
    @Column(name = "del_flag")
    public String getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(String delFlag) {
        this.delFlag = delFlag;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        BoardsEntity that = (BoardsEntity) o;
        return Objects.equals(id, that.id) &&
                Objects.equals(title, that.title) &&
                Objects.equals(createUser, that.createUser) &&
                Objects.equals(createUserunit, that.createUserunit) &&
                Objects.equals(statte, that.statte) &&
                Objects.equals(releaseTime, that.releaseTime) &&
                Objects.equals(createTime, that.createTime) &&
                Objects.equals(draftContent, that.draftContent) &&
                Objects.equals(updateTime, that.updateTime) &&
                Objects.equals(updateUser, that.updateUser) &&
                Objects.equals(delFlag, that.delFlag);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, title, createUser, createUserunit, statte, releaseTime, createTime, draftContent, updateTime, updateUser, delFlag);
    }
}
